<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        div{
            width: 200px;
            height: 20px;
            margin: 10px;
            background-color: blue;
            display: none;
            color: inherit;
        }
    </style>
    <script>
        function fun(gb){
            var gn = document.getElementById(gb);
                gn.style.display = "block";
        }
    </script>
</head>
<body>
<button onclick="fun('box1');">1</button>
<button onclick="fun('box2');">2</button>
<button onclick="fun('box3');">3</button>
<div id="box1">盒子一</div>
<div id="box2">盒子二</div>
<div id="box3">盒子三</div>
</body>
</html>